Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): Update remaining webhook routes to modular structure #2252

Merged
merged 14 commits into from
Oct 4, 2023

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Oct 1, 2023

What does this PR do?

  • Refactors remaining /webhook routes to format proposed here
  • Adds documentation
  • Updates types and tests
  • No changes to business logic, just a refactor - the only exception is to update the return type of one API endpoint (see comment)

image

@DafyddLlyr DafyddLlyr force-pushed the dp/slack-report-exemptions branch from 2f33404 to ad08273 Compare October 2, 2023 11:42
@DafyddLlyr DafyddLlyr changed the title refactor: Update remaining webhook routes to modular structure refactor(wip): Update remaining webhook routes to modular structure Oct 2, 2023
Base automatically changed from dp/slack-report-exemptions to main October 2, 2023 15:13
@DafyddLlyr DafyddLlyr force-pushed the dp/webhooks-api-next branch from b9babd2 to 7279188 Compare October 3, 2023 09:32
@DafyddLlyr DafyddLlyr force-pushed the dp/webhooks-api-next branch from 9243b20 to 409d2ca Compare October 3, 2023 10:00
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr force-pushed the dp/webhooks-api-next branch from eeed25d to d94b65e Compare October 3, 2023 10:38
@@ -25,13 +25,18 @@ type RequiredScheduledEventArgs = Pick<
"webhook" | "schedule_at" | "comment" | "payload"
>;

export interface ScheduledEventResponse {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing this cascaded across a few functions and tests which is a bit noisy for a PR, but quite nice in practice.

@@ -14,9 +17,9 @@ enum Destination {
}

interface CombinedResponse {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type is repeated in api.planx.uk/send/createSendEvents.ts but I'm ignoring this for now as this PR is already bigger than it should be.

payload: payload,
comment: `expiry_${payload.sessionId}`,
});
return [response];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning [response] as opposed to just response gives us a consistent return type across all these APIs.

@DafyddLlyr DafyddLlyr requested a review from a team October 4, 2023 07:41
@DafyddLlyr DafyddLlyr changed the title refactor(wip): Update remaining webhook routes to modular structure refactor(api): Update remaining webhook routes to modular structure Oct 4, 2023
@DafyddLlyr DafyddLlyr marked this pull request as ready for review October 4, 2023 07:41
@DafyddLlyr DafyddLlyr merged commit fadbae7 into main Oct 4, 2023
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/webhooks-api-next branch October 4, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants